package com.kotlin.library.rx

import com.kotlin.library.data.protocol.BaseResp
import rx.Observable
import rx.functions.Func1

/**
 *
 * USER: zjw
 * DATA: 2018/11/29 0029
 * TIME: 下午 3:52
 */
class BaseFunc<T> : Func1<BaseResp<T>, Observable<T>> {
    override fun call(t: BaseResp<T>?): Observable<T> {
        if (t!!.status != 0) {
            return Observable.error(BaseException(t!!.status, t!!.message))
        }
        return Observable.just(t.data)

    }
}